<?php
  class Shop
  {
		private $db;
		public function __construct($db)
		{
			if(is_object($db))
			{
				$this->db = $db;
			}
			else
			{
				die('Error! Authority construct need D3sql Object! Demo:  new Authority(- Add D3Sql() Object -)');
			}
		}
		
		/**
		* Return Shop List and Details
		* 
		* @param mixed $shopID
		*/
		public function getShop($shopID = false)
		{
			$getShopSQLText ="
								SELECT * FROM e_shop 
							";
			if($shopID)
			{
				$getShopSQLText .= " shop_id = ".$shopID;
			}
			$getShopSQLText .= " ORDER BY shop_nome ASC ";
			
			$getShopSQL = $this->db->sql($getShopSQLText);
			$getShopArray = array();
			while($getShop = $this->db->getir($getShopSQL))
			{
				$getShopArray[] = $getShop;
			}
			
			return $getShopArray;
		}
  }
?>
